package com.ymatou.iapi.mqcompensate.testcase;

import java.io.IOException;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.mqcompensate.parameter.StopBean;
import com.ymatou.iapi.mqcompensate.service.StopCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.MqCompensateCallService;
/**
*停止补单调度用例
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_Stop{
	private static StopBean stopBean;
	private static StopCall stopCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("停止补单调度用例");
	}

	@Before
	public void caseUp() {
		stopBean=new StopBean();
		stopCall=new StopCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(stopCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_Stop_001() {
		Logger.start(true,"停止补单调度");
		try {

			// 关掉自动补单
						new MqCompensateCallService().StartMqCompensate();
						
			stopCall.setData(stopBean);
			stopCall.callService();		
			
			Logger.verifyEquals("compensate task control: /stop<br/>stop success!", stopCall.getReturnData(), "验证Code");
			
			// 关掉自动补单
						new MqCompensateCallService().StartMqCompensate();
						
		} catch (Exception e) {
			Logger.fail(e);
			
			// 关掉自动补单
			try {
				new MqCompensateCallService().StopMqCompensate();
			} catch (IOException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
						
		}
	}
}